package com.alpha.processor.creators.info_model;

import com.alpha.processor.processor.tools.AnnoProcessorToolException;
import com.alpha.processor.util.TypeParametersUtil;

import java.util.List;

import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;

public class ConnectorInterfaceInfoModel {
    private String interfaceName;

    private String T_Name = "android.view.LayoutInflater";
    private String K_Name = "android.view.ViewGroup";
    private String L_Name = "android.view.View.OnClickListener";

    public void updateConnectorInterfaceInfo(TypeElement typeElement,List<? extends TypeMirror> superTypeList){
        this.interfaceName = typeElement.getQualifiedName().toString();

        String[] paramterArray = TypeParametersUtil.getSplitArray(superTypeList.get(0));
        if (paramterArray == null){
            throw new AnnoProcessorToolException("\nError: Missing Type Paramters ConnectorInterface<T,K,L>");
        }

        this.T_Name = paramterArray[0];
        this.K_Name = paramterArray[1];
        this.L_Name = paramterArray[2];
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public String getT_Name() {
        return T_Name;
    }

    public String getK_Name() {
        return K_Name;
    }

    public String getL_Name() {
        return L_Name;
    }
}
